cssnode: Change the way we start animations
authorBenjamin Otte <otte@redhat.com>
Sat, 21 Feb 2015 02:40:46 +0000 (03:40 +0100)
committerBenjamin Otte <otte@redhat.com>
Wed, 18 Mar 2015 14:23:32 +0000 (15:23 +0100)
We now have a flag for "invalidate animations", use that to restart
animations and decide if we want to start transitions.

gtk/gtkcsswidgetnode.c

index 2860d081a5d731ec459db8bece79a68a5f3f2731..8fff93117d8a950bc11362eb0dfa3cf05561b090 100644 (file)
@@ -85,22 +85,9 @@ gtk_css_widget_node_dequeue_validate (GtkCssNode *node)
 }
 
 static gboolean
-gtk_css_widget_node_should_create_transitions (GtkCssWidgetNode *widget_node,
-                                               GtkCssStyle      *previous_style)
+should_create_transitions (GtkCssChange change)
 {
-  GtkWidget *widget;
-
-  widget = widget_node->widget;
-  if (widget == NULL)
-    return FALSE;
-
-  if (!gtk_widget_get_mapped (widget))
-    return FALSE;
-
-  if (previous_style == gtk_css_static_style_get_default ())
-    return FALSE;
-
-  return TRUE;
+  return (change & GTK_CSS_CHANGE_ANIMATIONS) == 0;
 }
 
 static gboolean
@@ -168,7 +155,7 @@ gtk_css_widget_node_validate (GtkCssNode       *node,
                                               parent ? gtk_css_node_get_style (parent) : NULL,
                                               timestamp,
                                               gtk_css_node_get_style_provider (node),
-                                              gtk_css_widget_node_should_create_transitions (widget_node, style) ? style : NULL);
+                                              should_create_transitions (change) ? style : NULL);
       
       g_object_unref (new_static_style);
     }